package w2

import scala.math._

//函数引用
object FunRef {
  def loop: Int = {
    println("enter loop")
    loop
  }

  def func(x: Int, y: => Int): Int = {
    return 1
  }

  def main(args: Array[String]): Unit = {
    //sqrt
    val f = sqrt(_)
    println(f)
    println(f(49))
    var k = max(_: Double, _: Double)
    println(k(15, 22))
    println("-----------------------------")
    val x = 1
    var y = func(x, loop)
    println(s"y=${y}")
    y = func(loop, x)
    println(s"y=${y}")
  }
}
